﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ObjectTreeViewerForm.cs" company="tvori.info">
//   2012
// </copyright>
// <summary>
//   The object tree viewer form.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Syberia.Forms
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    using Syberia.Metacode;

    /// <summary>
    /// The object tree viewer form.
    /// </summary>
    public partial class ObjectTreeViewerForm : Form
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectTreeViewerForm"/> class. 
        /// </summary>
        /// <param name="o">
        /// The service
        /// </param>
        public ObjectTreeViewerForm(ObjectTreeViewerService o)
        {
            this.o = o;
            this.InitializeComponent();
        }

        /// <summary>
        /// Gets or sets service
        /// </summary>
        private ObjectTreeViewerService o;

        /// <summary>
        /// The object tree viewer form_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void ObjectTreeViewerForm_Load(object sender, EventArgs e)
        {
            this.o.ResetTree();
        }

        /// <summary>
        /// The tool strip button 1_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            this.o.ResetTree();
        }

        /// <summary>
        /// The tree view 1_ after select.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.o.NodeAfterSelect(e);
        }

        /// <summary>
        /// The tree view 1_ before expand.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            this.o.NodeBeforeExpand(e);
        }
    }
}